/**
 * Created by elead on 2019/1/3.
 */
//批量多条数据同时校验；
function multipleChecks(that,specialData){
    var taLen=$(that).parents("tr")[0];
    var otable=$(that).parents("table")[0]
    var side=$(otable).attr("id");
    if($(that).attr("type")=="number"){
        var values = Math.ceil($(that).val());
        if($(that).val()==""){
            $(that).val("")//防止用户在中文模式下输入字母
        }
        if(typeof values =="number"){
        }
    }

    if(specialData!=undefined&&specialData.length>0){
        //遍历错误数据行并高亮提示
        function errdataFn(errorsRowArr){

            if(errorsRowArr.length>0){
                var tipsMesg="";
                for(var k=0;k<errorsRowArr.length;k++){
                    $("#"+side).find("tr").eq((errorsRowArr[k]-1)).addClass("errTips");
                    tipsMesg+="第"+errorsRowArr[k]+"行数据，"
                }
                tipsMesg+="输入的物料号和受影响对象编号相同，或者输入的物料号之间相同。请修改后再进行操作。"
                layerFn(tipsMesg);
            }
        }
        var datasArr={
            datalist:specialData
        }
    switch (side){
        case "side3":
            var errorsRowArr=[];
            for(var j=0;j<specialData.length;j++){//遍历检验数据并检查书否相同
                if(specialData[j].oldnumber==specialData[j].effectnumber||specialData[j].newnumber==specialData[j].effectnumber||specialData[j].oldnumber==specialData[j].newnumber){
                    errorsRowArr.push(specialData[j].rowNmuber)
                }
            }
            errdataFn(errorsRowArr);
            var url="/ECOChange/tmReplaceCheck";
            ajaxNewFn(url,datasArr,function(result){
                if (result.result != ""&&result.result != undefined) {
                    layerFn(result.result);

                }if(result.errornumber!=undefined&&result.errornumber.length>0){
                    for(var i=0;i<result.errornumber.length;i++){
                        var num=result.errornumber[i];
                        if(num!=""){
                            num=parseInt(num)-1;
                            $("#"+side).find("tr").eq(num).addClass("errTips");
                        }
                    }
                } else {
                    $("#"+side).find("tr").removeClass("errTips");
                }
                if(result.datalist.length>0){
                    if(result.datalist.length>0){
                        if(specialData.length>1){
                            var allArr=[];
                            var oldArr=[];
                            for(var m=0;m<result.datalist.length;m++){
                                var flag = true;
                                var index= getIndexof(result.errornumber,result.datalist[m].rowNmuber)
                                if(index==(-1)){
                                    for(var j=0;j<allArr.length;j++){
                                        if(result.datalist[m].rowNmuber == allArr[j].rowNmuber){
                                            flag = false;
                                            oldArr.push(result.datalist[m]);
                                        };
                                    };
                                    if(flag){
                                        allArr.push(result.datalist[m]);
                                        // result.datalist.splice(m, 1);
                                    };
                                }
                            }
                            for(var n=0;n<allArr.length;n++){
                                if(allArr[n].rowNmuber!=undefined){
                                    var rowNmuber=parseInt(allArr[n].rowNmuber)-1;
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(3) input")[0].value=allArr[n].oldstate!=undefined?allArr[n].oldstate:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(4) input")[0].value=allArr[n].oldamount!=undefined?allArr[n].oldamount:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(5) input")[0].value=allArr[n].oldunit!=undefined?allArr[n].oldunit:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(6) input")[0].value=allArr[n].oldlinenumber!=undefined?allArr[n].oldlinenumber:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(8) input")[0].value=allArr[n].newstate!=undefined?allArr[n].newstate:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(9) input")[0].value=allArr[n].newamount!=undefined?allArr[n].newamount:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(10) input")[0].value=allArr[n].newunit!=undefined?allArr[n].newunit:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(11) input")[0].value=allArr[n].newlinenumber!=undefined?allArr[n].newlinenumber:"";
                                }
                            }
                            if(oldArr.length>0){
                                for(var k=0;k<oldArr.length;k++){
                                    var dataValueObj={
                                        oldnumber:oldArr[k].oldnumber!=undefined?oldArr[k].oldnumber:"",
                                        oldstate:oldArr[k].oldstate!=undefined?oldArr[k].oldstate:"",
                                        oldamount:oldArr[k].oldamount!=undefined?oldArr[k].oldamount:"",
                                        oldunit:oldArr[k].oldunit!=undefined?oldArr[k].oldunit:"",
                                        oldlinenumber:oldArr[k].oldlinenumber!=undefined?oldArr[k].oldlinenumber:"",
                                        newnumber:oldArr[k].newnumber!=undefined?oldArr[k].newnumber:"",
                                        newstate:oldArr[k].newstate!=undefined?oldArr[k].newstate:"",
                                        newamount:oldArr[k].oldamount!=undefined?oldArr[k].oldamount:"",
                                        newunit:oldArr[k].newunit!=undefined?oldArr[k].newunit:"",
                                        newlinenumber:oldArr[k].newlinenumber!=undefined?oldArr[k].newlinenumber:"",
                                        effView:oldArr[k].effectnumber+"("+oldArr[k].view+")"
                                    }
                                    var dataobjArr=[];
                                    for(var v in dataValueObj){
                                        dataobjArr.push(dataValueObj[v]);
                                    }
                                    //$($(taLen)[0]).after(creatTrMoreAddNone(dataobjArr));
                                    $("#side3 tbody").append(creatTrMore(dataobjArr));
                                    //$("#side3 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                }
                            }
                            var addLen=$("#"+side).find(".addCuloumn");
                            if(addLen.length>1){
                                $("#"+side).find(".addCuloumn").css("display","none");
                                $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                            }
                        }else if(/*result.errornumber.length==0&&*/specialData.length==1){
                           // for(var m=0;m<result.datalist.length;m++){
                               /* $(taLen).find("td:nth-child(3) input")[0].value=result.datalist[m].amount;
                                $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[m].linenumber;*/

                                $(taLen).find("td:nth-child(3) input")[0].value=result.datalist[0].oldstate!=undefined?result.datalist[0].oldstate:"";
                                $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[0].oldamount!=undefined?result.datalist[0].oldamount:"";
                                $(taLen).find("td:nth-child(5) input")[0].value=result.datalist[0].oldunit!=undefined?result.datalist[0].oldunit:"";
                                $(taLen).find("td:nth-child(6) input")[0].value=result.datalist[0].oldlinenumber!=undefined?result.datalist[0].oldlinenumber:"";
                                $(taLen).find("td:nth-child(8) input")[0].value=result.datalist[0].newstate!=undefined?result.datalist[0].newstate:"";
                                $(taLen).find("td:nth-child(9) input")[0].value=result.datalist[0].oldamount!=undefined?result.datalist[0].oldamount:"";
                                $(taLen).find("td:nth-child(10) input")[0].value=result.datalist[0].newunit!=undefined?result.datalist[0].newunit:"";
                                $(taLen).find("td:nth-child(11) input")[0].value=result.datalist[0].newlinenumber!=undefined?result.datalist[0].newlinenumber:"";
                                if(result.datalist.length>1){
                                    for(var t=1;t<result.datalist.length;t++){
                                        var dataValueObj={
                                            oldnumber:result.datalist[t].oldnumber!=undefined?result.datalist[t].oldnumber:"",
                                            oldstate:result.datalist[t].oldstate!=undefined?result.datalist[t].oldstate:"",
                                            oldamount:result.datalist[t].oldamount!=undefined?result.datalist[t].oldamount:"",
                                            oldunit:result.datalist[t].oldunit!=undefined?result.datalist[t].oldunit:"",
                                            oldlinenumber:result.datalist[t].oldlinenumber!=undefined?result.datalist[t].oldlinenumber:"",
                                            newnumber:result.datalist[t].newnumber!=undefined?result.datalist[t].newnumber:"",
                                            newstate:result.datalist[t].newstate!=undefined?result.datalist[t].newstate:"",
                                            newamount:result.datalist[t].oldamount!=undefined?result.datalist[t].oldamount:"",
                                            newunit:result.datalist[t].newunit!=undefined?result.datalist[t].newunit:"",
                                            newlinenumber:result.datalist[t].newlinenumber!=undefined?result.datalist[t].newlinenumber:"",
                                            effView:result.datalist[t].effectnumber+"("+result.datalist[t].view+")"
                                        }
                                        var dataobjArr=[];
                                        for(var v in dataValueObj){
                                            dataobjArr.push(dataValueObj[v])
                                        }
                                        $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        var addLen=$("#"+side).find(".addCuloumn");
                                        if(addLen.length>1){
                                            $("#"+side).find(".addCuloumn").css("display","none");
                                            $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                                        }
                                        //$("#side3 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                    }
                                }

                            }
                       // }
                        setReadonly();
                        serialNum("#"+side);
                        singleRemoveSearch();
                    }
                }
            })
            break;
        case "side5"://新增替代料
            var errorsRowArr=[];
            for(var j=0;j<specialData.length;j++){//遍历检验数据并检查书否相同
                if(specialData[j].numberA==specialData[j].effectnumber||specialData[j].numberB==specialData[j].effectnumber||specialData[j].numberB==specialData[j].numberA){
                    errorsRowArr.push(specialData[j].rowNmuber)
                }
            }
            errdataFn(errorsRowArr);
                var url="/ECOChange/addReplacePartCheck";
            ajaxNewFn(url,datasArr,function(result){
                    if (result.result!=undefined&&result.result!="") {
                        layerFn(result.result);
                    }if(result.errornumber!=undefined&&result.errornumber.length>0){
                        for(var i=0;i<result.errornumber.length;i++){
                            var num=result.errornumber[i];
                            if(num!=""){
                                num=parseInt(num)-1;
                                $("#"+side).find("tr").eq(num).addClass("errTips");
                            }
                        }
                    } else {
                        $("#"+side).find("tr").removeClass("errTips");
                    }
                    if(result.datalist.length>0){
                        if(result.datalist.length>0){
                            if(specialData.length>1){
                                var allArr=[];
                                var oldArr=[];
                                for(var m=0;m<result.datalist.length;m++){
                                    var flag = true;
                                    var index= getIndexof(result.errornumber,result.datalist[m].rowNmuber)
                                    if(index==(-1)){
                                        for(var j=0;j<allArr.length;j++){
                                            if(result.datalist[m].rowNmuber == allArr[j].rowNmuber){
                                                flag = false;
                                                oldArr.push(result.datalist[m]);
                                            };
                                        };
                                        if(flag){
                                            allArr.push(result.datalist[m]);
                                            // result.datalist.splice(m, 1);
                                        };
                                    }

                                }
                                for(var n=0;n<allArr.length;n++){
                                    if(allArr[n].rowNmuber!=undefined){
                                        var rowNmuber=parseInt(allArr[n].rowNmuber)-1;
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(7) input")[0].value=allArr[n].amountB!=undefined?allArr[n].amountB:"";
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(3) input")[0].value=allArr[n].stateA!=undefined?allArr[n].stateA:"";
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(4) input")[0].value=allArr[n].linenumberA!=undefined?allArr[n].linenumberA:"";
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(6) input")[0].value=allArr[n].stateB!=undefined?allArr[n].stateB:"";
                                        $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(8) input")[0].value=allArr[n].unitB!=undefined?allArr[n].unitB:"";

                                    }
                                }
                                if(oldArr.length>0){
                                    for(var k=0;k<oldArr.length;k++){
                                        var dataValueObj={
                                            numberA:oldArr[k].numberA!=undefined?oldArr[k].numberA:"",
                                            stateA:oldArr[k].stateA!=undefined?oldArr[k].stateA:"",
                                            linenumberA:oldArr[k].linenumberA!=undefined?oldArr[k].linenumberA:"",
                                            numberB:oldArr[k].numberB!=undefined?oldArr[k].numberB:"",
                                            stateB:oldArr[k].stateB!=undefined?oldArr[k].stateB:"",
                                            amountB:oldArr[k].amountB!=undefined?oldArr[k].amountB:"",
                                            unitB:oldArr[k].unitB!=undefined?oldArr[k].unitB:"",
                                            effView:oldArr[k].effectnumber+"("+oldArr[k].view+")"
                                        }
                                        var dataobjArr=[];
                                        for(var v in dataValueObj){
                                            dataobjArr.push(dataValueObj[v]);
                                        }
                                        //$($(taLen)[0]).after(creatTrMoreAddNone(dataobjArr));
                                        $("#side5 tbody").append(creatTrMore(dataobjArr));
                                        //$("#side5 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                    }
                                }
                                var addLen=$("#"+side).find(".addCuloumn");
                                if(addLen.length>1){
                                    $("#"+side).find(".addCuloumn").css("display","none");
                                    $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                                }
                            }else if(/*result.errornumber.length==0||*/specialData.length==1){
                                //for(var m=0;m<result.datalist.length;m++){
                                    $(taLen).find("td:nth-child(7) input")[0].value=result.datalist[0].amountB!=undefined?result.datalist[0].amountB:"";
                                    $(taLen).find("td:nth-child(3) input")[0].value=result.datalist[0].stateA!=undefined?result.datalist[0].stateA:"";
                                    $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[0].linenumberA!=undefined?result.datalist[0].linenumberA:"";
                                    $(taLen).find("td:nth-child(6) input")[0].value=result.datalist[0].stateB!=undefined?result.datalist[0].stateB:"";
                                    $(taLen).find("td:nth-child(8) input")[0].value=result.datalist[0].unitB!=undefined?result.datalist[0].unitB:"";
                                    if(result.datalist.length>1){
                                        for(var t=1;t<result.datalist.length;t++){
                                            var dataValueObj={
                                                numberA:result.datalist[t].numberA!=undefined?result.datalist[t].numberA:"",
                                                stateA:result.datalist[t].stateA!=undefined?result.datalist[t].stateA:"",
                                                linenumberA:result.datalist[t].linenumberA!=undefined?result.datalist[t].linenumberA:"",
                                                numberB:result.datalist[t].numberB!=undefined?result.datalist[t].numberB:"",
                                                stateB:result.datalist[t].stateB!=undefined?result.datalist[t].stateB:"",
                                                amountB:result.datalist[t].amountB!=undefined?result.datalist[t].amountB:"",
                                                unitB:result.datalist[t].unitB!=undefined?result.datalist[t].unitB:"",
                                                effView:result.datalist[t].effectnumber+"("+result.datalist[t].view+")"
                                            }
                                            var dataobjArr=[];
                                            for(var v in dataValueObj){
                                                dataobjArr.push(dataValueObj[v])
                                            }
                                            $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                            //$("#side5 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                            var addLen=$("#"+side).find(".addCuloumn");
                                            if(addLen.length>1){
                                                $("#"+side).find(".addCuloumn").css("display","none");
                                                $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                                            }
                                        }
                                    }

                                //}
                            }
                            //setReadonly();
                            serialNum("#"+side);
                            singleRemoveSearch();
                        }
                    }
                })

            break;
        case "side6"://删除替代料
            var errorsRowArr=[];
            for(var j=0;j<specialData.length;j++){//遍历检验数据并检查书否相同
                if(specialData[j].numberA==specialData[j].effectnumber||specialData[j].numberB==specialData[j].effectnumber||specialData[j].numberB==specialData[j].numberA){
                    errorsRowArr.push(specialData[j].rowNmuber)
                }
            }
            errdataFn(errorsRowArr);
                    var url = "/ECOChange/deleteReplacePartCheck";
            ajaxNewFn(url,datasArr,function(result){
                if (result.result != undefined&&result.result != "") {
                    layerFn(result.result);

                }if(result.errornumber!=undefined&&result.errornumber.length>0){
                    for(var i=0;i<result.errornumber.length;i++){
                        var num=result.errornumber[i];
                        if(num!=""){
                            num=parseInt(num)-1;
                            $("#"+side).find("tr").eq(num).addClass("errTips");
                        }
                    }
                } else {
                    $("#"+side).find("tr").removeClass("errTips");
                }
                if(result.datalist.length>0){
                    if(result.datalist.length>0){
                        if(specialData.length>1){
                            var allArr=[];
                            var oldArr=[];
                            for(var m=0;m<result.datalist.length;m++){
                                var flag = true;
                                var index= getIndexof(result.errornumber,result.datalist[m].rowNmuber)
                                if(index==(-1)){
                                    for(var j=0;j<allArr.length;j++){
                                        if(result.datalist[m].rowNmuber == allArr[j].rowNmuber){
                                            flag = false;
                                            oldArr.push(result.datalist[m]);
                                        };
                                    };
                                    if(flag){
                                        allArr.push(result.datalist[m]);
                                        // result.datalist.splice(m, 1);
                                    };
                                }
                            }
                            for(var n=0;n<allArr.length;n++){
                                if(allArr[n].rowNmuber!=undefined){
                                    var rowNmuber=parseInt(allArr[n].rowNmuber)-1;
                                   // $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(7) input")[0].value=allArr[n].amountB;
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(3) input")[0].value=allArr[n].stateA!=undefined?allArr[n].stateA:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(4) input")[0].value=allArr[n].linenumberA!=undefined?allArr[n].linenumberA:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(6) input")[0].value=allArr[n].stateB!=undefined?allArr[n].stateB:"";
                                    //$("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(8) input")[0].value=allArr[n].unitA;

                                }
                            }
                            if(oldArr.length>0){
                                for(var k=0;k<oldArr.length;k++){
                                    var dataValueObj={
                                        numberA:oldArr[k].numberA!=undefined?oldArr[k].numberA:"",
                                        stateA:oldArr[k].stateA!=undefined?oldArr[k].stateA:"",
                                        linenumberA:oldArr[k].linenumberA!=undefined?oldArr[k].linenumberA:"",
                                        numberB:oldArr[k].numberB!=undefined?oldArr[k].numberB:"",
                                        stateB:oldArr[k].stateB!=undefined?oldArr[k].stateB:"",
                                        effView:oldArr[k].effectnumber+"("+oldArr[k].view+")"
                                    }
                                    var dataobjArr=[];
                                    for(var v in dataValueObj){
                                        dataobjArr.push(dataValueObj[v]);
                                    }
                                    //$($(taLen)[0]).after(creatTrMoreAddNone(dataobjArr));
                                    $("#side6 tbody").append(creatTrMore(dataobjArr));
                                    //$("#side6 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                }
                            }
                            var addLen=$("#"+side).find(".addCuloumn");
                            if(addLen.length>1){
                                $("#"+side).find(".addCuloumn").css("display","none");
                                $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                            }
                        }else if(result.errornumber.length==0&&specialData.length==1){
                            //for(var m=0;m<result.datalist.length;m++){
                                /*$(taLen).find("td:nth-child(3) input")[0].value=result.datalist[m].amount;
                                $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[m].linenumber;*/
                                $(taLen).find("td:nth-child(3) input")[0].value=result.datalist[0].stateA!=undefined?result.datalist[0].stateA:"";
                                $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[0].linenumberA!=undefined?result.datalist[0].linenumberA:"";
                                $(taLen).find("td:nth-child(6) input")[0].value=result.datalist[0].stateB!=undefined?result.datalist[0].stateB:"";
                                if(result.datalist.length>1){
                                    for(var t=1;t<result.datalist.length;t++){
                                        var dataValueObj={
                                            numberA:result.datalist[t].numberA!=undefined?result.datalist[t].numberA:"",
                                            stateA:result.datalist[t].stateA!=undefined?result.datalist[t].stateA:"",
                                            linenumberA:result.datalist[t].linenumberA!=undefined?result.datalist[t].linenumberA:"",
                                            numberB:result.datalist[t].numberB!=undefined?result.datalist[t].numberB:"",
                                            stateB:result.datalist[t].stateB!=undefined?result.datalist[t].stateB:"",
                                            effView:result.datalist[t].effectnumber+"("+result.datalist[t].view+")"
                                        }
                                        var dataobjArr=[];
                                        for(var v in dataValueObj){
                                            dataobjArr.push(dataValueObj[v])
                                        }
                                        $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        var addLen=$("#"+side).find(".addCuloumn");
                                        if(addLen.length>1){
                                            $("#"+side).find(".addCuloumn").css("display","none");
                                            $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                                        }
                                        //$("#side3 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                    }
                                }

                           // }
                        }
                        setReadonly();
                        serialNum("#"+side);
                        singleRemoveSearch();
                    }
                }
            })
            break;
        case "side7"://更换替代料
            var errorsRowArr=[];
            for(var j=0;j<specialData.length;j++){//遍历检验数据并检查书否相同
                if(specialData[j].partAnumber==specialData[j].effectnumber||specialData[j].oldpartnumber==specialData[j].effectnumber||specialData[j].oldpartnumber==specialData[j].partAnumber||specialData[j].partAnumber==specialData[j].newpartnumber||specialData[j].oldpartnumber==specialData[j].newpartnumber||specialData[j].newpartnumber==specialData[j].effectnumber){
                    errorsRowArr.push(specialData[j].rowNmuber)
                }
            }
            errdataFn(errorsRowArr);
                    var url="/ECOChange/replaceOldPartCheck";
            ajaxNewFn(url,datasArr,function(result){
                if (result.result != undefined&&result.result != "") {
                    layerFn(result.result);

                }if(result.errornumber!=undefined&&result.errornumber.length>0){
                    for(var i=0;i<result.errornumber.length;i++){
                        var num=result.errornumber[i];
                        if(num!=""){
                            num=parseInt(num)-1;
                            $("#"+side).find("tr").eq(num).addClass("errTips");
                        }
                    }
                } else {
                    $("#"+side).find("tr").removeClass("errTips");
                }
                if(result.datalist.length>0){
                    if(result.datalist.length>0){
                        if(specialData.length>1){
                            var allArr=[];
                            var oldArr=[];
                            for(var m=0;m<result.datalist.length;m++){
                                var flag = true;
                                var index= getIndexof(result.errornumber,result.datalist[m].rowNmuber)
                                if(index==(-1)){
                                    for(var j=0;j<allArr.length;j++){
                                        if(result.datalist[m].rowNmuber == allArr[j].rowNmuber){
                                            flag = false;
                                            oldArr.push(result.datalist[m]);
                                        };
                                    };
                                    if(flag){
                                        allArr.push(result.datalist[m]);
                                        // result.datalist.splice(m, 1);
                                    };
                                }
                            }
                            for(var n=0;n<allArr.length;n++){
                                if(allArr[n].rowNmuber!=undefined){
                                    var rowNmuber=parseInt(allArr[n].rowNmuber)-1;
                                    // $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(7) input")[0].value=allArr[n].amountB;
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(3) input")[0].value=allArr[n].partAstate!=undefined?allArr[n].partAstate:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(4) input")[0].value=allArr[n].partAlinenumber!=undefined?allArr[n].partAlinenumber:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(6) input")[0].value=allArr[n].oldstate!=undefined?allArr[n].oldstate:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(7) input")[0].value=allArr[n].oldpartamount!=undefined?allArr[n].oldpartamount:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(8) input")[0].value=allArr[n].oldunit!=undefined?allArr[n].oldunit:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(10) input")[0].value=allArr[n].newstate!=undefined?allArr[n].newstate:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(11) input")[0].value=allArr[n].newpartamount!=undefined?allArr[n].newpartamount:"";
                                    $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(12) input")[0].value=allArr[n].newunit!=undefined?allArr[n].newunit:"";
                                }
                            }
                            if(oldArr.length>0){
                                for(var k=0;k<oldArr.length;k++){
                                    var dataValueObj={
                                        partAnumber:oldArr[k].partAnumber!=undefined?oldArr[k].partAnumber:"",
                                        partAstate:oldArr[k].partAstate!=undefined?oldArr[k].partAstate:"",
                                        partAlinenumber:oldArr[k].partAlinenumber!=undefined?oldArr[k].partAlinenumber:"",
                                        oldpartnumber:oldArr[k].oldpartnumber!=undefined?oldArr[k].oldpartnumber:"",
                                        oldstate:oldArr[k].oldstate!=undefined?oldArr[k].oldstate:"",
                                        oldpartamount:oldArr[k].oldpartamount!=undefined?oldArr[k].oldpartamount:"",
                                        oldunit:oldArr[k].oldunit!=undefined?oldArr[k].oldunit:"",
                                        newpartnumber:oldArr[k].newpartnumber!=undefined?oldArr[k].newpartnumber:"",
                                        newstate:oldArr[k].newstate!=undefined?oldArr[k].newstate:"",
                                        newpartamount:oldArr[k].newpartamount!=undefined?oldArr[k].newpartamount:"",
                                        newunit:oldArr[k].newunit!=undefined?oldArr[k].newunit:"",
                                        effView:oldArr[k].effectnumber+"("+oldArr[k].view+")"
                                    }
                                    var dataobjArr=[];
                                    for(var v in dataValueObj){
                                        dataobjArr.push(dataValueObj[v]);
                                    }
                                    //$($(taLen)[0]).after(creatTrMoreAddNone(dataobjArr));
                                    $("#side7 tbody").append(creatTrMore(dataobjArr));
                                    //$("#side7 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                }
                            }
                            var addLen=$("#"+side).find(".addCuloumn");
                            if(addLen.length>1){
                                $("#"+side).find(".addCuloumn").css("display","none");
                                $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                            }
                        }else if(result.errornumber.length==0&&specialData.length==1){
                           // for(var m=0;m<result.datalist.length;m++){
                                /*$(taLen).find("td:nth-child(3) input")[0].value=result.datalist[m].amount;
                                 $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[m].linenumber;*/
                                //$(taLen).find("td:nth-child(3) input")[0].value=result.datalist[m].stateA;
                                $(taLen).find("td:nth-child(3) input")[0].value=result.datalist[0].partAstate!=undefined?result.datalist[0].partAstate:"";
                                $(taLen).find("td:nth-child(4) input")[0].value=result.datalist[0].partAlinenumber!=undefined?result.datalist[0].partAlinenumber:"";
                                $(taLen).find("td:nth-child(6) input")[0].value=result.datalist[0].oldstate!=undefined?result.datalist[0].oldstate:"";
                                $(taLen).find("td:nth-child(7) input")[0].value=result.datalist[0].oldpartamount!=undefined?result.datalist[0].oldpartamount:"";
                                $(taLen).find("td:nth-child(8) input")[0].value=result.datalist[0].oldunit!=undefined?result.datalist[0].oldunit:"";
                                $(taLen).find("td:nth-child(10) input")[0].value=result.datalist[0].newstate!=undefined?result.datalist[0].newstate:"";
                                $(taLen).find("td:nth-child(11) input")[0].value=result.datalist[0].newpartamount!=undefined?result.datalist[0].newpartamount:"";
                                $(taLen).find("td:nth-child(12) input")[0].value=result.datalist[0].newunit!=undefined?result.datalist[0].newunit:"";
                                if(result.datalist.length>1){
                                    for(var t=1;t<result.datalist.length;t++){
                                        var dataValueObj={
                                            partAnumber:result.datalist[t].partAnumber!=undefined?result.datalist[t].partAnumber:"",
                                            partAstate:result.datalist[t].partAstate!=undefined?result.datalist[t].partAstate:"",
                                            partAlinenumber:result.datalist[t].partAlinenumber!=undefined?result.datalist[t].partAlinenumber:"",
                                            oldpartnumber:result.datalist[t].oldpartnumber!=undefined?result.datalist[t].oldpartnumber:"",
                                            oldpartamount:result.datalist[t].oldpartamount!=undefined?result.datalist[t].oldpartamount:"",
                                            oldstate:result.datalist[t].oldstate!=undefined?result.datalist[t].oldstate:"",
                                            oldunit:result.datalist[t].oldunit!=undefined?result.datalist[t].oldunit:"",
                                            newpartnumber:result.datalist[t].newpartnumber!=undefined?result.datalist[t].newpartnumber:"",
                                            newstate:result.datalist[t].newstate!=undefined?result.datalist[t].newstate:"",
                                            newpartamount:result.datalist[t].newpartamount!=undefined?result.datalist[t].newpartamount:"",
                                            newunit:result.datalist[t].newunit!=undefined?result.datalist[t].newunit:"",
                                            effView:result.datalist[t].effectnumber+"("+result.datalist[t].view+")"
                                        }
                                        var dataobjArr=[];
                                        for(var v in dataValueObj){
                                            dataobjArr.push(dataValueObj[v])
                                        }
                                        $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        var addLen=$("#"+side).find(".addCuloumn");
                                        if(addLen.length>1){
                                            $("#"+side).find(".addCuloumn").css("display","none");
                                            $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                                        }
                                        //$("#side3 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                    }
                                }

                            }
                      // }
                        setReadonly();
                        serialNum("#"+side);
                        singleRemoveSearch();
                    }
                }
            })

            break;
        case "side8"://更换主料
            var errorsRowArr=[];
            for(var j=0;j<specialData.length;j++){//遍历检验数据并检查书否相同
                if(specialData[j].oldpartnumber==specialData[j].effectnumber||specialData[j].newpartnumber==specialData[j].effectnumber||specialData[j].newpartnumber==specialData[j].oldpartnumber){
                    errorsRowArr.push(specialData[j].rowNmuber)
                }
            }
            errdataFn(errorsRowArr);
            var url = "/ECOChange/repalcePartACheck";
            ajaxNewFn(url, datasArr, function (result) {
                if (result.result != undefined&&result.result != "") {
                    layerFn(result.result);

                }
                if (result.errornumber != undefined && result.errornumber.length > 0) {
                    for (var i = 0; i < result.errornumber.length; i++) {
                        var num = result.errornumber[i];
                        if (num != "") {
                            num = parseInt(num) - 1;
                            $("#" + side).find("tr").eq(num).addClass("errTips");
                        }
                    }
                } else {
                    $("#" + side).find("tr").removeClass("errTips");
                }
                if (result.datalist.length > 0) {
                    if (result.datalist.length > 0) {
                        if (specialData.length > 1) {
                            var allArr = [];
                            var oldArr = [];
                            for (var m = 0; m < result.datalist.length; m++) {
                                var flag = true;
                                var index= getIndexof(result.errornumber,result.datalist[m].rowNmuber)
                                if(index==(-1)){
                                    for(var j=0;j<allArr.length;j++){
                                        if(result.datalist[m].rowNmuber == allArr[j].rowNmuber){
                                            flag = false;
                                            oldArr.push(result.datalist[m]);
                                        };
                                    };
                                    if(flag){
                                        allArr.push(result.datalist[m]);
                                        // result.datalist.splice(m, 1);
                                    };
                                }
                            }
                            for (var n = 0; n < allArr.length; n++) {
                                if (allArr[n].rowNmuber != undefined) {
                                    var rowNmuber = parseInt(allArr[n].rowNmuber) - 1;
                                    // $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(7) input")[0].value=allArr[n].amountB;
                                    $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(3) input")[0].value = allArr[n].oldstate!=undefined?allArr[n].oldstate:"";
                                    $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(4) input")[0].value = allArr[n].oldpartlinenumber!=undefined?allArr[n].oldpartlinenumber:"";
                                    $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(5) input")[0].value = allArr[n].oldpartamount!=undefined?allArr[n].oldpartamount:"";
                                    $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(6) input")[0].value = allArr[n].oldunit!=undefined?allArr[n].oldunit:"";
                                    $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(8) input")[0].value = allArr[n].newstate!=undefined?allArr[n].newstate:"";
                                    $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(9) input")[0].value = allArr[n].oldpartamount!=undefined?allArr[n].oldpartamount:"";
                                    $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(10) input")[0].value = allArr[n].newunit!=undefined?allArr[n].newunit:"";
                                    //$("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(8) input")[0].value=allArr[n].unitA;

                                }
                            }
                            if (oldArr.length > 0) {
                                for (var k = 0; k < oldArr.length; k++) {
                                    var dataValueObj = {
                                        oldpartnumber: oldArr[k].oldpartnumber!=undefined?oldArr[k].oldpartnumber:"",
                                        oldstate: oldArr[k].oldstate!=undefined?oldArr[k].oldstate:"",
                                        oldpartlinenumber: oldArr[k].oldpartlinenumber!=undefined?oldArr[k].oldpartlinenumber:"",
                                        oldpartamount: oldArr[k].oldpartamount!=undefined?oldArr[k].oldpartamount:"",
                                        oldunit: oldArr[k].oldunit!=undefined?oldArr[k].oldunit:"",
                                        newpartnumber: oldArr[k].newpartnumber!=undefined?oldArr[k].newpartnumber:"",
                                        newstate: oldArr[k].newstate!=undefined?oldArr[k].newstate:"",
                                        newpartamount: oldArr[k].oldpartamount!=undefined?oldArr[k].oldpartamount:"",
                                        newunit: oldArr[k].newunit!=undefined?oldArr[k].newunit:"",
                                        effView: oldArr[k].effectnumber + "(" + oldArr[k].view + ")"
                                    }
                                    var dataobjArr = [];
                                    for (var v in dataValueObj) {
                                        dataobjArr.push(dataValueObj[v]);
                                    }
                                    //$($(taLen)[0]).after(creatTrMoreAddNone(dataobjArr));
                                    $("#side8 tbody").append(creatTrMore(dataobjArr));
                                    //$("#side8 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                }
                            }
                            var addLen = $("#" + side).find(".addCuloumn");
                            if (addLen.length > 1) {
                                $("#" + side).find(".addCuloumn").css("display", "none");
                                $("#" + side).find("tr:nth-last-child(1) .addCuloumn").css("display", "block");

                            }
                        } else if (result.errornumber.length == 0 && specialData.length == 1) {

                                $(taLen).find("td:nth-child(3) input")[0].value = result.datalist[0].oldstate!=undefined?result.datalist[0].oldstate:"";
                                $(taLen).find("td:nth-child(4) input")[0].value = result.datalist[0].oldpartlinenumber!=undefined?result.datalist[0].oldpartlinenumber:"";
                                $(taLen).find("td:nth-child(5) input")[0].value = result.datalist[0].oldpartamount!=undefined?result.datalist[0].oldpartamount:"";
                                $(taLen).find("td:nth-child(6) input")[0].value = result.datalist[0].oldunit!=undefined?result.datalist[0].oldunit:"";
                                $(taLen).find("td:nth-child(8) input")[0].value = result.datalist[0].newstate!=undefined?result.datalist[0].newstate:"";
                                $(taLen).find("td:nth-child(9) input")[0].value = result.datalist[0].newpartamount!=undefined?result.datalist[0].newpartamount:"";
                                $(taLen).find("td:nth-child(10) input")[0].value = result.datalist[0].newunit!=undefined?result.datalist[0].newunit:"";
                                if (result.datalist.length > 1) {
                                    for (var t = 1; t < result.datalist.length; t++) {
                                        var dataValueObj = {
                                            oldpartnumber: result.datalist[t].oldpartnumber!=undefined?result.datalist[t].oldpartnumber:"",
                                            oldstate: result.datalist[t].oldstate!=undefined?result.datalist[t].oldstate:"",
                                            oldpartlinenumber: result.datalist[t].oldpartlinenumber!=undefined?result.datalist[t].oldpartlinenumber:"",
                                            oldpartamount: result.datalist[t].oldpartamount!=undefined?result.datalist[t].oldpartamount:"",
                                            oldunit: result.datalist[t].oldunit!=undefined?result.datalist[t].oldunit:"",
                                            newpartnumber: result.datalist[t].newpartnumber!=undefined?result.datalist[t].newpartnumber:"",
                                            newstate: result.datalist[t].newstate!=undefined?result.datalist[t].newstate:"",
                                            newpartamount: result.datalist[t].newpartamount!=undefined?result.datalist[t].newpartamount:"",
                                            newunit: result.datalist[t].newunit!=undefined?result.datalist[t].newunit:"",
                                            effView: result.datalist[t].effectnumber + "(" + result.datalist[t].view + ")"
                                        }
                                        var dataobjArr = [];
                                        for (var v in dataValueObj) {
                                            dataobjArr.push(dataValueObj[v])
                                        }
                                        $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        var addLen=$("#"+side).find(".addCuloumn");
                                        if(addLen.length>1){
                                            $("#"+side).find(".addCuloumn").css("display","none");
                                            $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                                        }
                                        //$("#side3 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                    }
                                }

                            //}
                        }
                        setReadonly();
                        serialNum("#" + side);
                        singleRemoveSearch();
                    }
                }
            })
            break;
        case "side9":
            var errorsRowArr=[];
            for(var j=0;j<specialData.length;j++){//遍历检验数据并检查书否相同
                if(specialData[j].partANumber==specialData[j].effectnumber||specialData[j].partBNumber==specialData[j].effectnumber||specialData[j].partBNumber==specialData[j].partANumber){
                    errorsRowArr.push(specialData[j].rowNmuber)
                }
            }
            errdataFn(errorsRowArr);
            var url = "/ECOChange/repalcePartAAndPartBCheck";

            ajaxNewFn(url, datasArr, function (result) {
                if ( result.result != undefined&&result.result != "") {
                    layerFn(result.result);

                }
                if (result.errornumber != undefined && result.errornumber.length > 0) {
                    for (var i = 0; i < result.errornumber.length; i++) {
                        var num = result.errornumber[i];
                        if (num != "") {
                            num = parseInt(num) - 1;
                            $("#" + side).find("tr").eq(num).addClass("errTips");
                        }
                    }
                } else {
                    $("#" + side).find("tr").removeClass("errTips");
                }
                if (result.datalist.length > 0) {
                    if (result.datalist.length > 0) {
                        if (specialData.length > 1) {
                            var allArr = [];
                            var oldArr = [];
                            for (var m = 0; m < result.datalist.length; m++) {
                                var flag = true;
                                var index= getIndexof(result.errornumber,result.datalist[m].rowNmuber)
                                if(index==(-1)){
                                    for(var j=0;j<allArr.length;j++){
                                        if(result.datalist[m].rowNmuber == allArr[j].rowNmuber){
                                            flag = false;
                                            oldArr.push(result.datalist[m]);
                                        };
                                    };
                                    if(flag){
                                        allArr.push(result.datalist[m]);
                                        // result.datalist.splice(m, 1);
                                    };
                                }
                            }
                            for (var n = 0; n < allArr.length; n++) {
                                if (allArr[n].rowNmuber != undefined) {
                                    var rowNmuber = parseInt(allArr[n].rowNmuber) - 1;
                                    // $("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(7) input")[0].value=allArr[n].amountB;
                                    $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(3) input")[0].value = allArr[n].stateA!=undefined ? allArr[n].stateA : "";
                                    $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(4) input")[0].value = allArr[n].linenumber!=undefined ? allArr[n].linenumber : "";
                                    $("#" + side).find("tr").eq(rowNmuber).find("td:nth-child(6) input")[0].value = allArr[n].stateB!=undefined ? allArr[n].stateB : "";
                                    //$("#"+side).find("tr").eq(rowNmuber).find("td:nth-child(8) input")[0].value=allArr[n].unitA;

                                }
                            }
                            if (oldArr.length > 0) {
                                for (var k = 0; k < oldArr.length; k++) {
                                    var dataValueObj = {
                                        partANumber: oldArr[k].partANumber!=undefined? oldArr[k].partANumber:"",
                                        stateA: oldArr[k].stateA!=undefined? oldArr[k].stateA:"",
                                        linenumber: oldArr[k].linenumber!=undefined? oldArr[k].linenumber : "",
                                        partBNumber: oldArr[k].partBNumber!=undefined? oldArr[k].partBNumber:"",
                                        stateB: oldArr[k].stateB!=undefined? oldArr[k].stateB:"",
                                        effView: oldArr[k].effectnumber + "(" + oldArr[k].view + ")"
                                    }
                                    var dataobjArr = [];
                                    for (var v in dataValueObj) {
                                        dataobjArr.push(dataValueObj[v]);
                                    }
                                    //$($(taLen)[0]).after(creatTrMoreAddNone(dataobjArr));
                                    $("#side9 tbody").append(creatTrMore(dataobjArr));
                                    //$("#side9 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                }
                            }
                            var addLen = $("#" + side).find(".addCuloumn");
                            if (addLen.length > 1) {
                                $("#" + side).find(".addCuloumn").css("display", "none");
                                $("#" + side).find("tr:nth-last-child(1) .addCuloumn").css("display", "block");

                            }
                        } else if (/*result.errornumber.length == 0 &&*/ specialData.length == 1) {
                                $(taLen).find("td:nth-child(3) input")[0].value = result.datalist[0].stateA!=undefined ? result.datalist[0].stateA : "";
                                $(taLen).find("td:nth-child(4) input")[0].value = result.datalist[0].linenumber!=undefined ? result.datalist[0].linenumber : "";
                                $(taLen).find("td:nth-child(6) input")[0].value = result.datalist[0].stateB!=undefined ? result.datalist[0].stateB : "";
                                if (result.datalist.length > 1) {
                                    for (var t = 1; t < result.datalist.length; t++) {
                                        var dataValueObj = {
                                            partANumber: result.datalist[t].partANumber!=undefined?result.datalist[t].partANumber:"",
                                            stateA: result.datalist[t].stateA!=undefined?result.datalist[t].stateA:"",
                                            linenumber: result.datalist[t].linenumber!=undefined ? result.datalist[t].linenumber : "",
                                            partBNumber: result.datalist[t].partBNumber!=undefined?result.datalist[t].partBNumber:"",
                                            stateB: result.datalist[t].stateB!=undefined?result.datalist[t].stateB:"",
                                            effView: result.datalist[t].effectnumber + "(" + result.datalist[t].view + ")"
                                        }
                                        var dataobjArr = [];
                                        for (var v in dataValueObj) {
                                            dataobjArr.push(dataValueObj[v])
                                        }
                                        $($(taLen)[0]).after(creatTrMore(dataobjArr));
                                        var addLen=$("#"+side).find(".addCuloumn");
                                        if(addLen.length>1){
                                            $("#"+side).find(".addCuloumn").css("display","none");
                                            $("#"+side).find("tr:nth-last-child(1) .addCuloumn").css("display","block");

                                        }
                                        //$("#side3 tbody tr:nth-last-child(2)").after(creatTrMoreAddNone(dataobjArr));
                                    }
                                }

                            //}
                        }
                        setReadonly();
                        serialNum("#" + side);
                        singleRemoveSearch();
                    }
                }
            })
            break;
    }

}
    function singleRemoveSearch(){
        var urlData=getQueryStringByNameTwo("single");
        if(urlData=="true"){
            $(".ecoTabsTable tr td .searchPage").remove();
            $(".tab tr td:nth-last-child(1) i").css({
                width:"50%"
            })
        }
    }
}

function setReadonly(){
    $("#side1 tr td:nth-child(3) input").attr("readonly","readonly");
    $("#side1 tr td:nth-child(5) input").attr("readonly","readonly");
    $("#side2 tr td:nth-child(3) input").attr("readonly","readonly");
    $("#side2 tr td:nth-child(4) input").attr("readonly","readonly");
    $("#side2 tr td:nth-child(5) input").attr("readonly","readonly");
    $("#side2 tr td:nth-child(6) input").attr("readonly","readonly");

    $("#side3 tr td:nth-child(3) input").attr("readonly","readonly");
    $("#side3 tr td:nth-child(4) input").attr("readonly","readonly");
    $("#side3 tr td:nth-child(5) input").attr("readonly","readonly");
    $("#side3 tr td:nth-child(6) input").attr("readonly","readonly");
    $("#side3 tr td:nth-child(8) input").attr("readonly","readonly");
    $("#side3 tr td:nth-child(10) input").attr("readonly","readonly");
    $("#side3 tr td:nth-child(11) input").attr("readonly","readonly");

    $("#side4 tr td:nth-child(3) input").attr("readonly","readonly");
    $("#side4 tr td:nth-child(4) input").attr("readonly","readonly");
    $("#side4 tr td:nth-child(5) input").attr("readonly","readonly");
    $("#side4 tr td:nth-child(6) input").attr("readonly","readonly");
    $("#side4 tr td:nth-child(8) input").attr("readonly","readonly");

    $("#side5 tr td:nth-child(3) input").attr("readonly","readonly");
    $("#side5 tr td:nth-child(4) input").attr("readonly","readonly");
    $("#side5 tr td:nth-child(6) input").attr("readonly","readonly");
    $("#side5 tr td:nth-child(8) input").attr("readonly","readonly");

    $("#side6 tr td:nth-child(3) input").attr("readonly","readonly");
    $("#side6 tr td:nth-child(4) input").attr("readonly","readonly");
    $("#side6 tr td:nth-child(6) input").attr("readonly","readonly");

    $("#side7 tr td:nth-child(3) input").attr("readonly","readonly");
    $("#side7 tr td:nth-child(4) input").attr("readonly","readonly");
    $("#side7 tr td:nth-child(6) input").attr("readonly","readonly");
    $("#side7 tr td:nth-child(7) input").attr("readonly","readonly");
    $("#side7 tr td:nth-child(8) input").attr("readonly","readonly");
    $("#side7 tr td:nth-child(10) input").attr("readonly","readonly");
    $("#side7 tr td:nth-child(12) input").attr("readonly","readonly");

    $("#side8 tr td:nth-child(3) input").attr("readonly","readonly");
    $("#side8 tr td:nth-child(4) input").attr("readonly","readonly");
    $("#side8 tr td:nth-child(5) input").attr("readonly","readonly");
    $("#side8 tr td:nth-child(6) input").attr("readonly","readonly");
    $("#side8 tr td:nth-child(8) input").attr("readonly","readonly");
    $("#side8 tr td:nth-child(10) input").attr("readonly","readonly");

    $("#side9 tr td:nth-child(3) input").attr("readonly","readonly");
    $("#side9 tr td:nth-child(4) input").attr("readonly","readonly");
    $("#side9 tr td:nth-child(6) input").attr("readonly","readonly");
	
	//add by xucr on 20210125 添加替代料用量修改 begin
	$("#side10 tr td:nth-child(3) input").attr("readonly","readonly");
	$("#side10 tr td:nth-child(5) input").attr("readonly","readonly");
	$("#side10 tr td:nth-child(6) input").attr("readonly","readonly");
	$("#side10 tr td:nth-child(7) input").attr("readonly","readonly");
	//add by xucr on 20210125 添加替代料用量修改 end
	
    //兼容IE去掉光标
    $("#side1 tr td:nth-child(3) input").attr("unselectable","on");
    $("#side1 tr td:nth-child(5) input").attr("unselectable","on");
    $("#side2 tr td:nth-child(3) input").attr("unselectable","on");
    $("#side2 tr td:nth-child(4) input").attr("unselectable","on");

    $("#side3 tr td:nth-child(3) input").attr("unselectable","on");
    $("#side3 tr td:nth-child(4) input").attr("unselectable","on");
    $("#side3 tr td:nth-child(5) input").attr("unselectable","on");
    $("#side3 tr td:nth-child(6) input").attr("unselectable","on");
    $("#side3 tr td:nth-child(8) input").attr("unselectable","on");
    $("#side3 tr td:nth-child(10) input").attr("unselectable","on");
    $("#side3 tr td:nth-child(11) input").attr("unselectable","on");

    $("#side4 tr td:nth-child(3) input").attr("unselectable","on");
    $("#side4 tr td:nth-child(4) input").attr("unselectable","on");
    $("#side4 tr td:nth-child(5) input").attr("unselectable","on");
    $("#side4 tr td:nth-child(6) input").attr("unselectable","on");
    $("#side4 tr td:nth-child(8) input").attr("unselectable","on");

    $("#side5 tr td:nth-child(3) input").attr("unselectable","on");
    $("#side5 tr td:nth-child(4) input").attr("unselectable","on");
    $("#side5 tr td:nth-child(6) input").attr("unselectable","on");
    $("#side5 tr td:nth-child(8) input").attr("unselectable","on");

    $("#side6 tr td:nth-child(3) input").attr("unselectable","on");
    $("#side6 tr td:nth-child(4) input").attr("unselectable","on");
    $("#side6 tr td:nth-child(6) input").attr("unselectable","on");

    $("#side7 tr td:nth-child(3) input").attr("unselectable","on");
    $("#side7 tr td:nth-child(4) input").attr("unselectable","on");
    $("#side7 tr td:nth-child(6) input").attr("unselectable","on");
    $("#side7 tr td:nth-child(7) input").attr("unselectable","on");
    $("#side7 tr td:nth-child(8) input").attr("unselectable","on");
    $("#side7 tr td:nth-child(10) input").attr("unselectable","on");
    $("#side7 tr td:nth-child(12) input").attr("unselectable","on");

    $("#side8 tr td:nth-child(3) input").attr("unselectable","on");
    $("#side8 tr td:nth-child(4) input").attr("unselectable","on");
    $("#side8 tr td:nth-child(5) input").attr("unselectable","on");
    $("#side8 tr td:nth-child(6) input").attr("unselectable","on");
    $("#side8 tr td:nth-child(8) input").attr("unselectable","on");
    $("#side8 tr td:nth-child(10) input").attr("unselectable","on");

    $("#side9 tr td:nth-child(3) input").attr("unselectable","on");
    $("#side9 tr td:nth-child(4) input").attr("unselectable","on");
    $("#side9 tr td:nth-child(6) input").attr("unselectable","on");
    
    //add by xucr on 20210125 添加替代料用量修改 begin
	$("#side10 tr td:nth-child(3) input").attr("unselectable","on");
	$("#side10 tr td:nth-child(5) input").attr("unselectable","on");
	$("#side10 tr td:nth-child(6) input").attr("unselectable","on");
	$("#side10 tr td:nth-child(7) input").attr("unselectable","on");
	//add by xucr on 20210125 添加替代料用量修改 end

    //
    $("#side1 tr td:nth-child(4) input").attr("type","number");
    $("#side3 tr td:nth-child(9) input").attr("type","number");
    $("#side4 tr td:nth-child(7) input").attr("type","number");
    $("#side5 tr td:nth-child(7) input").attr("type","number");
    $("#side7 tr td:nth-child(11) input").attr("type","number");
    $("#side10 tr td:nth-child(8) input").attr("type","number");
	//add by xucr on 20210126 替代料用量设置为number
	$("#side8 tr td:nth-child(9) input").attr("type","number");
    $(".tab tr input").attr("autocomplete","off");
    $(".ecoTabsTable").attr("autocomplete","off");
    for(var i=0;i<$(".tab tr input").length;i++){
        var isReadonly=$(".tab tr input").eq(i).attr("readonly");
        if(isReadonly=="readonly"){
            $(".tab tr input").eq(i).parent().css({
                "background":"#eee"
            })
        }
    }

}

function serialNum(side){
    var num = side!=""&&side!=undefined?$(side+" .serialNum"):$(".serialNum");
    //$(".tab tr td input").attr("maxlength",16);
   // $(".tab tr td:nth-last-child(2) input").attr("maxlength",25);
    var urlData=getQueryStringByNameTwo("single");
    if(urlData=="true"){
        $(".tab tr td:nth-last-child(2) input").attr("readonly","readonly");
    }
    setReadonly();
    for(var i = 0;i<num.length;i++){
        num[i].innerHTML=i+1;
    }
}